﻿namespace WPForms.Common
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Property and class description attribute.
    /// System.ComponentModel.DescriptionAttribute is not available in a Portable Class Library so had to implement this again. Doh..
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
    public sealed class DescriptionAttribute : Attribute
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DescriptionAttribute" /> class.
        /// </summary>
        /// <param name="description">The description.</param>
        public DescriptionAttribute(string description)
        {
            this.Description = description;
            this.State = EditorBrowsableState.Always;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="DescriptionAttribute" /> class.
        /// </summary>
        /// <param name="description">The description.</param>
        /// <param name="state">The state.</param>
        public DescriptionAttribute(
            string description,
            EditorBrowsableState state)
        {
            this.Description = description;
            this.State = state;
        }

        /// <summary>
        /// Gets the description.
        /// </summary>
        public string Description { get; private set; }

        /// <summary>
        /// Gets the browsable state.
        /// </summary>
        public EditorBrowsableState State { get; private set; }
    }
}
